using micromsg;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Protocol;
using System;
namespace MicroMsg.Scene
{
	public class NetSceneSendCard : NetSceneBaseEx<SendCardRequest, SendCardResponse, SendCardRequest.Builder>
	{
		private const string TAG = "NetSceneSendCard";
		private const uint USERINFO_QRCODE_NOW_STYLE = 66561u;
		private const uint USERINFO_QRCODE_FRIST_IN = 66562u;
		public bool doScene(string strContent, SendCardType type, uint style, string strContentEx = "")
		{
			base.beginBuilder();
			this.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0);
			this.mBuilder.UserName = AccountMgr.getCurAccount().strUsrName;
			this.mBuilder.Content = strContent;
			this.mBuilder.SendCardBitFlag = (uint)type;
			this.mBuilder.Style = style;
			if (type == SendCardType.MM_SENDCARD_READER)
			{
				this.mBuilder.ContentEx = strContentEx;
			}
			this.mSessionPack.mCmdID = 42;
			base.endBuilder();
			return true;
		}
		protected override void onFailed(SendCardRequest request, SendCardResponse response)
		{
			Log.smethod_1("NetSceneSendCard", "send SendCardRequest failed");
			EventCenter.postEvent(EventConst.ON_NETSCENE_SEND_CARD_ERR, RetConst.MM_ERR_CLIENT, null);
		}
		protected override void onSuccess(SendCardRequest request, SendCardResponse response)
		{
			RetConst ret = (RetConst)response.BaseResponse.Ret;
			if (ret != RetConst.MM_OK)
			{
				Log.smethod_1("NetSceneSendCard", "send SendCardRequest failed ret =" + ret);
				EventCenter.postEvent(EventConst.ON_NETSCENE_SEND_CARD_ERR, ret, null);
				return;
			}
			EventCenter.postEvent(EventConst.ON_NETSCENE_SEND_CARD_SUCCESS, ret, null);
		}
	}
}
